package com.youxin.cpcenter.controller;

import java.util.concurrent.Future;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import com.youxin.busfoundation.bean.ResponseObject;
import com.youxin.busfoundation.bean.log.RequestLogBean;
import com.youxin.busfoundation.enums.SystemType;
import com.youxin.cpcenter.api.LogApi;


@RestController
public class BaseController {
	protected static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(BaseController.class);

	@Autowired
	protected LogApi logApi;	
	protected Future<ResponseObject> saveLog(LogApi logApi,String identifier)
	{
		try {
			RequestLogBean logBean=new RequestLogBean();
			logBean.setSystemType(SystemType.CP.getValue());
			logBean.setIdentifier(identifier);
			return logApi.saveLogAsync(logBean);
		} catch (Exception e) {
			logger.error("保存日志异常:", e);
			return null;
		}
		
	}
}
